<!DESCRIPTION>This script places the cursor in the first field of a form when the page loads and when the form is reset or cleared. The script works with input types: text, textarea, radio, checkbox, password and Select drop-down boxes.<!/DESCRIPTION>
<!CATEGORY>Forms<!/CATEGORY>
<!SCRIPT>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL FIRST FORM FIELD:
1. Copy code into the HEAD section of document
2. Add the onLoad event handler into the BODY tag
3. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Wayne Nolting (wayne@dtg.net) -->
<!-- Begin
function toForm() {
document.form.field1.focus();
// Replace field1 in the script with the field name of which you want to place the focus.
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->
<BODY onLoad="toForm()">
<!-- STEP THREE: Copy code into BODY section of document -->
<FORM NAME="form" METHOD="POST" ACTION="#">
<SELECT NAME="field1" SIZE="1">
<OPTION VALUE="one">Field 1
<OPTION VALUE="two">also field1
</SELECT>
<BR>
<INPUT TYPE="TEXT" NAME="field2" SIZE="10"> Field 2<BR>
<INPUT TYPE="TEXT" NAME="field3" SIZE="10"> Field 3<BR>